package com.ygqh.baby.model;

import com.ygqh.baby.ao.AppType;
import com.ygqh.baby.ao.OrderStatus;
import com.ygqh.baby.ao.OrderType;

import java.math.BigDecimal;
import java.util.List;

public class SaveOrderBySkuParam {

    private Long userId;
    private Long addressId;
    private AppType appType;
    private BigDecimal expressPrice;
    private BigDecimal accountPrice;
    private OrderType orderType;
    private Long releationId;
    private String platformNo;
    private String formId;

    private Boolean reduceStock;
    private Boolean delCar;
    private OrderStatus orderStatus;

    private List<SaveOrderBySkuDetailParam> detailList;


    public SaveOrderBySkuParam(Long userId, Long addressId, AppType appType, BigDecimal accountPrice, BigDecimal expressPrice, OrderType orderType, Long releationId,
                               String platformNo, String formId, Boolean reduceStock, Boolean delCar,
                               OrderStatus orderStatus, List<SaveOrderBySkuDetailParam> detailList) {
        this.userId = userId;
        this.addressId = addressId;
        this.appType = appType;
        this.accountPrice = accountPrice;
        this.expressPrice = expressPrice;
        this.orderType = orderType;
        this.releationId = releationId;
        this.platformNo = platformNo;
        this.formId = formId;
        this.reduceStock = reduceStock;
        this.delCar = delCar;
        this.orderStatus = orderStatus;
        this.detailList = detailList;
    }

    public BigDecimal getAccountPrice() {
        return accountPrice;
    }

    public void setAccountPrice(BigDecimal accountPrice) {
        this.accountPrice = accountPrice;
    }

    public OrderStatus getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(OrderStatus orderStatus) {
        this.orderStatus = orderStatus;
    }

    public List<SaveOrderBySkuDetailParam> getDetailList() {
        return detailList;
    }

    public void setDetailList(List<SaveOrderBySkuDetailParam> detailList) {
        this.detailList = detailList;
    }

    public String getFormId() {
        return formId;
    }

    public void setFormId(String formId) {
        this.formId = formId;
    }

    public BigDecimal getTotalPrice() {
        return getProductPrice().add(expressPrice).subtract(accountPrice);
    }

    public BigDecimal getProductPrice() {
        return detailList.stream().map(detail -> detail.getSalePrice().multiply(new BigDecimal(detail.getQuantity()))).reduce(BigDecimal.ZERO, BigDecimal::add);
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getAddressId() {
        return addressId;
    }

    public void setAddressId(Long addressId) {
        this.addressId = addressId;
    }


    public AppType getAppType() {
        return appType;
    }

    public void setAppType(AppType appType) {
        this.appType = appType;
    }

    public BigDecimal getExpressPrice() {
        return expressPrice;
    }

    public void setExpressPrice(BigDecimal expressPrice) {
        this.expressPrice = expressPrice;
    }

    public OrderType getOrderType() {
        return orderType;
    }

    public void setOrderType(OrderType orderType) {
        this.orderType = orderType;
    }

    public Long getReleationId() {
        return releationId;
    }

    public void setReleationId(Long releationId) {
        this.releationId = releationId;
    }

    public String getPlatformNo() {
        return platformNo;
    }

    public void setPlatformNo(String platformNo) {
        this.platformNo = platformNo;
    }

    public Boolean getReduceStock() {
        return reduceStock;
    }

    public void setReduceStock(Boolean reduceStock) {
        this.reduceStock = reduceStock;
    }

    public Boolean getDelCar() {
        return delCar;
    }

    public void setDelCar(Boolean delCar) {
        this.delCar = delCar;
    }


}
